<template>
  <div id="certificate">  

    <div  style="display:flex;margin-bottom:10px;align-items: center;">
            <img class="top_img" src="@/assets/images/a8.png" style="width:35px;height:35px;margin-right:10px;"/>
            <div style="line-height: 40px;font-weight:bold:">{{ variable_name2 }}券管理</div>
     </div> 
   <el-form ref="form" label-width="70px" style="width:100%;">
       <div style="display:flex;align-items: center;">
            <div style="width:50px;text-align-last: justify;margin-top:-12px;font-size: 14px;color: #606266;margin-right:10px;">查询项</div> 
           <el-form-item label="手机号码">
                <el-input v-model="form.phone" placeholder="姓名/手机号" style="width:140px;"></el-input>
           </el-form-item>  
            <div class="buttoon_box">
                <div class="buttoon_box_item"  style="margin-left:10px;background:#FFC600;color:white;" @click="search_but1()">确 定</div>
                <div class="buttoon_box_item" style="margin-left:10px;border:1px solid #D9D9D9;" @click="sx_but()">清 空</div>    
            </div> 
        </div>

        <div style="display:flex;align-items: center;">
            <div style="width:50px;text-align-last: justify;margin-top:-12px;font-size: 14px;color: #606266;margin-right:10px;">筛选项</div> 
            <el-form-item :label="variable_name2 + '余额'"  >
                    <div style="display: flex;">
                        <el-input style="width:80px;" v-model.number="form.gdb_min" placeholder=""></el-input>
                        <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                        <el-input  style="width:80px;" v-model.number="form.gdb_max" placeholder=""></el-input>
                    </div>
            </el-form-item> 

            <el-form-item label="金蜜券" style="margin-left:10px;" label-width="60px">
                <el-select  v-model="form.select_num" placeholder="金蜜券" style="width:140px;">
                    <el-option  v-for="(item,index) in select_data" :key="index" :label="item.title" :value="item.maid"></el-option>
                </el-select>
             </el-form-item>

            <el-form-item label="输入区间" style="margin-left:10px;" >
                    <div style="display: flex;">
                        <el-input style="width:80px;" v-model.number="form.ticket_min" placeholder=""></el-input>
                        <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                        <el-input  style="width:80px;" v-model.number="form.ticket_max" placeholder=""></el-input>
                    </div>
            </el-form-item> 

            <div class="buttoon_box">
                <div class="buttoon_box_item"  style="margin-left:10px;background:#FFC600;color:white;" @click="search_but1()">确 定</div>
                <div class="buttoon_box_item" style="margin-left:10px;border:1px solid #D9D9D9;" @click="sx_but()">清 空</div>    
            </div>
        </div>

    </el-form>


    <div style="display:flex;margin-bottom:10px;" v-if="statisticslist_show">
              <div class="con_box" >
                   <div class="con_box_item1 bg_color1">
                          <div class="con_box_item_top">持有数</div>
                   </div>
                   <div class="con_box_item2">
                       <div class="item_b" >
                                <div class="item_b_1">
                                  <img class="item_b_1_img"  src="@/assets/images/zy1.png" />
                                     {{ variable_kind1 }}<span  class="see_span" @click="show_but(statisticslist[0].maid,1)"><i class="el-icon-view el-icon--right"></i></span> 
                                </div>
                                <div class="item_b_2">
                                     {{ statisticslist[0].hold_num }}
                                </div>
                            </div>
                            <div class="item_b" >
                                <div class="item_b_1">
                                  <img class="item_b_1_img"  src="@/assets/images/zy2.png" />
                                     {{ variable_kind2 }}<span  class="see_span" @click="show_but(statisticslist[1].maid,1)"><i class="el-icon-view el-icon--right"></i></span> 
                                </div>
                                <div class="item_b_2">
                                     {{ statisticslist[1].hold_num }}
                                </div>
                            </div>
                            <div class="item_b" >
                                <div class="item_b_1">
                                  <img class="item_b_1_img"  src="@/assets/images/zy3.png" />
                                     {{ variable_kind3 }}<span  class="see_span" @click="show_but(statisticslist[2].maid,1)"><i class="el-icon-view el-icon--right"></i></span> 
                                </div>
                                <div class="item_b_2">
                                     {{ statisticslist[2].hold_num }}
                                </div>
                            </div>
                            <div class="item_b" >
                                <div class="item_b_1">
                                  <img class="item_b_1_img"  src="@/assets/images/zy4.png" />
                                     {{ variable_kind4 }}<span  class="see_span" @click="show_but(statisticslist[3].maid,1)"><i class="el-icon-view el-icon--right"></i></span> 
                                </div>
                                <div class="item_b_2">
                                     {{ statisticslist[3].hold_num }}
                                </div>
                            </div>
                    </div>
              </div>
              <div class="con_box" >
                   <div class="con_box_item1 bg_color1">
                          <div class="con_box_item_top">消耗数</div>
                   </div>
                   <div class="con_box_item2">
                       <div class="item_b" >
                                <div class="item_b_1">
                                  <img class="item_b_1_img"  src="@/assets/images/zy1.png" />
                                     {{ variable_kind1 }}<span  class="see_span" @click="show_but(statisticslist[0].maid,2)"><i class="el-icon-view el-icon--right"></i></span> 
                                </div>
                                <div class="item_b_2">
                                     {{ statisticslist[0].used_num }}
                                </div>
                            </div>
                            <div class="item_b" >
                                <div class="item_b_1">
                                  <img class="item_b_1_img"  src="@/assets/images/zy2.png" />
                                     {{ variable_kind2 }}<span  class="see_span" @click="show_but(statisticslist[1].maid,2)"><i class="el-icon-view el-icon--right"></i></span> 
                                </div>
                                <div class="item_b_2">
                                     {{ statisticslist[1].used_num }}
                                </div>
                            </div>
                            <div class="item_b" >
                                <div class="item_b_1">
                                  <img class="item_b_1_img"  src="@/assets/images/zy3.png" />
                                     {{ variable_kind3 }}<span  class="see_span" @click="show_but(statisticslist[2].maid,2)"><i class="el-icon-view el-icon--right"></i></span> 
                                </div>
                                <div class="item_b_2">
                                     {{ statisticslist[2].used_num }}
                                </div>
                            </div>
                            <div class="item_b" >
                                <div class="item_b_1">
                                  <img class="item_b_1_img"  src="@/assets/images/zy4.png" />
                                     {{ variable_kind4 }}<span  class="see_span" @click="show_but(statisticslist[3].maid,2)"><i class="el-icon-view el-icon--right"></i></span> 
                                </div>
                                <div class="item_b_2">
                                     {{ statisticslist[3].used_num }}
                                </div>
                            </div>
                    </div>
              </div>
      </div>

   <!-- 渲染数据list -->
   <certificate-list :datalist="datalist" @up_list_fun="list_fun" :select_data="select_data"> </certificate-list>

      
   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>


    <el-dialog title='来源明细' :visible.sync="mtk1"  width="600px">
          <div style="width:100%;"> 
               <div class="item_a" style="display:flex;padding:0px 0px 40px 0px;">
                      <div class="item_b">
                          <div class="item_b_1" style="justify-content: center;">邀请抢拍</div>
                          <div class="item_b_2" style="text-align: center;">{{ infor_data.invite_num }}</div>
                      </div>
                      <div class="item_b">
                          <div class="item_b_1" style="justify-content: center;">活动获得</div>
                          <div class="item_b_2" style="text-align: center;">{{ infor_data.activity_num }}</div>
                      </div>
                       <div class="item_b">
                          <div class="item_b_1" style="justify-content: center;">后台调控</div>
                          <div class="item_b_2" style="text-align: center;">{{ infor_data.manage_num }}</div>
                      </div>
               </div>
          </div> 
      </el-dialog>
   

      
  </div>
</template>

<script>
import CertificateList from '@/view/Jindou/CertificateList'
export default {
  name: 'certificate',
  data () {
    return {
        datalist:[],
        page:1,
        count:0,
        form:{
            phone:'',
            gdb_min:'',
            gdb_max:'',
            select_num:'',
            ticket_min:'',
        },
        select_data:[],
        mtk1:false,
        statisticslist:[],
        statisticslist_show:false,
        infor_data:[]
    }
  },
 components:{
    CertificateList
  },
  created(){
       this.list_fun()
       this.list_zy()
       this.list_statistics()
       
  },
  mounted (){
    
  },
  methods: {
    list_zy(){
      this.post("/manor/manorOption", {
       }).then(res => { 
          this.statisticslist_show = true
           this.select_data = res.result     
           //console.log(this.select_data)                  
       })
    },
    list_statistics(){
      
        this.post("/gdb_new_ticket/statistics", {
	        }).then(res => {
            this.statisticslist = res.result
            //console.log(res.result,"vvvv")
         })

    },
    list_fun(){
      
        this.post("/gdb_new_ticket/listOfData", {
              page:this.page,
              account:this.form.phone,
              gdb_min:this.form.gdb_min,
              gdb_max:this.form.gdb_max,
              maid:this.form.select_num,
              ticket_min:this.form.ticket_min,
              ticket_max:this.form.ticket_max,
	        }).then(res => {
            this.count = res.result.count
            this.datalist = res.result.list
            //console.log(res,"aaa")
         })

    },
    show_but(maid,type){
         this.post("/gdb_new_ticket/detailOfSource", {
          maid:maid,
          type:type,
          uid:''
       }).then(res => { 
          // this.statisticslist_show = true
          //  this.select_data = res.result  
          this.infor_data = res.result    
          //console.log(res.result  )                  
       })
        
        this.mtk1 = true
    },
    search_but1(){
        this.page = 1
        this.list_fun()
    },
    search_but2(){
        this.page = 1
        this.list_fun()
    },
    sx_but(){
      this.form={
          phone:'',
          gdb_min:'',
          gdb_max:'',
          select_num:'',
          ticket_min:'',
      },
      this.page = 1
      this.list_fun()
    },
     handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>
.buttoon_box{
  display:flex;margin-bottom:10px;
}
.buttoon_box_item{
  height:40px;line-height:40px;width:60px;font-size:14px;text-align:center;border-radius:5px;
}
.el-input-box>>>input{
  padding: 0px 3px !important;
}
.item_a{
  display:flex;
  padding:0px 15px;
}
.item_b{
  /* flex: 1; */
  float: left;
  width: calc(100%/2);
  margin-top:30px;
}
.item_b_1{
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  color: #5E6C84;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item_b_1_img{
  width:20px;
  height: 20px;
  margin-right:5px;
}
.item_b_2{
  /* margin-top: 10px; */
  text-align: center;
  font-size: 30px;
  font-weight: 500;
  color: #344563;
}



.con_box{
  display: flex;
  flex-direction: column;
  flex: 1;
}
.con_box:first-child{
  border-right: 2px dashed #F7F7FD;
}
.con_box_item1{
  height: 35px;
  line-height: 35px;
  padding-left: 50px;
  color:white;
}
.bg_color1{
  background-color: #FF6B40;
 
}
.bg_color2{
   background-color: #5E62FF;
}
.bg_color3{
  background-color: #40ACFF;
}
.con_box_item2{
    padding: 15px;
    height: 170px;
    background-color: #F7F7FD;
}
.con_box_item2>.item_b{
  margin-top: 15px;
}
.title_box{
  display: flex;
   font-size: 16px;
  color: #333333;
    align-items: center;
    margin:15px 0px;
}
.title_box_yuan{
  width: 8px;
  height: 8px;
  border-radius:50%;
  margin-right:10px;
}
</style>
